import React from 'react';
import { HashRouter as Router, Routes, Route, useParams } from 'react-router-dom';
import TwitterSearch from './components/Search/TwitterSearch';
import CyberBackground from './components/Search/Content/CyberBackground';
import './App.css';

// SearchContainer component used to retrieve URL parameters and pass them to TwitterSearch
function SearchContainer() {
  const { address } = useParams();
  return <TwitterSearch initialAddress={address} />;
}

function App() {
  return (
    <Router>
      <Routes>
        {/* Home route */}
        <Route path="/" element={<SearchContainer />} />
        {/* Route with address parameter */}
        <Route path="/:address" element={<SearchContainer />} />
      </Routes>
    </Router>
  );
}

export default App;
